Home / DeveloperSection / Interviews / __init__()
You haven’t finished your post yet. Are you sure you want to leave and discard your draft?
Can you answer this question?
Prakash nidhi Verma
The __init__() Function:
classes and objects in their simplest form are not really useful in real life applications. It's a built-in __init__() function.
Example :
Use the __init__() function to assign values for name and age:
class Person: def __init__(self, name, age): self.name = name self.age = age p1 = Person("Prakash", 19) print(p1.name) print(p1.age)
You have need login or register for voting of answers or question.
Prakash nidhi Verma
04-Jul-2018The __init__() Function:
classes and objects in their simplest form are not really useful in real life applications. It's a built-in __init__() function.
Example :
Use the __init__() function to assign values for name and age: